package com.qyhl.webtv.module_news.news.goodlife.list;


import com.qyhl.webtv.commonlib.entity.news.NewsBean;

import java.util.List;

/**
 * Created by qyhl on 2017/11/27.
 */

public class GoodLifeListPresenter implements GoodLifeListContract.GoodLifeListPresenter {
    private GoodLifeListModel mModel;

    private GoodLifeListActivity mView;

    public GoodLifeListPresenter(GoodLifeListActivity mView) {
        this.mView = mView;
        this.mModel = new GoodLifeListModel(this);
    }

    @Override
    public void getTopNum(String id) {
        mModel.getTopNum(id);
    }

    @Override
    public void getData(String id, String lastId) {
        mModel.getData(id, lastId);
    }

    @Override
    public void setTopNum(int num) {
        mView.setTopNum(num);
    }

    @Override
    public void setData(List<NewsBean> beanList, boolean isMore) {
        mView.setData(beanList,isMore);
    }

    @Override
    public void setError(int code, String msg) {
        switch (code) {
            case 0:
                mView.setNetError(msg);
                break;
            case 1:
                mView.showMessage(msg);
                break;
            case 2:
                mView.setEmpty(msg);
                break;
            case 3:
                mView.showLog(msg);
                break;
            case 4:
                mView.setError(msg);
                break;
            case 5:
                mView.showMessage(msg);
                break;
            default:break;
        }
    }

    @Override
    public void topNumError() {
        mView.topNumError();
    }
}
